<template>
    <div id="home">
        <ul>
            <li v-for="(item,index) in banners">
                <img :src="item.image" alt="" />
            </li>
        </ul>
    </div>
</template>

<script>
import {request} from '../../network/request'
    export default {
        name:"Home",
        data(){
            return{
                banners:[],
                offsetWidth:"",
            }
        },
        created(){
            request({
                url:"/home/multidata"
            }).then(res=>{
                this.banners = res.data.banner.list
            });
            this.startTimer();
        },
        methods:{
            startTimer(){
                // let home = document.querySelector('#home');
                // let ul = document.querySelector('ul');
                // let w = home.offsetWidth;
                // var index = 0;
                // ul.setTimeout(() => {
                //     index++;
                //     var translatex = -index * w;
                //     ul.style.transform = 'translateX('+translatex+'px)';
                // }, 2000);
                console.log(1);
            }
        }
    }
</script>

<style>
#home{
    width: 100%;
    height: 100%;
    overflow: hidden;
}
#home ul{
    width: 400%;
    height: 100%;
}
#home ul li{
    width: 20%;
    height: 100%;
}
#home ul li img{
    height: 100%;
    width: 100%;
}
</style>